Account:

<?php
function showaccount($name,$code,$at)
{
  echo "
<br>&nbsp;&nbsp;$code:
<br>&nbsp;&nbsp;&nbsp;&nbsp;name: $name
<br>&nbsp;&nbsp;&nbsp;&nbsp;code: $code
<br>&nbsp;&nbsp;&nbsp;&nbsp;AccountType: $at
";
}


$asset=". Cash in Treasury (101)
. Petty Cash Fund (105)
. Cash – Disbursing Officers (107)
. Cash in Bank – Local Currency, Current Account (110)
. Cash in Bank – Local Currency, Savings Account (111)
. Cash in Bank – Local Currency, Time Deposits (112)
. Cash in Bank – Foreign Currency, Current Account (113)
. Cash in Bank – Foreign Currency, Savings Account (114)
. Cash in Bank – Foreign Currency, Time Deposits (115)
. Accounts Receivable (121)
. Notes Receivable (122)
. Loans Receivable, Current (123)
. Real Property Tax Receivable (124)
. Special Education Tax Receivable (125)
. Interests Receivable (126)
. Due from Officers and Employees (128)
. Due from Other Funds (129)
. Due from NGAs (130)
. Due from LGUs (131)
. Due from GOCCs (132)
. Due from NGOs/POs (133)
. Receivables – Disallowances/Charges (138)
. Other Receivables (139)
. Allowance for Doubtful Accounts (301)
. Treasury Bills (140)
. Stocks (141)
. Bonds (142)
. Other Marketable Securities (143)
. Raw Materials Inventory (144)
. Work-In-Process Inventory (145)
. Finished Goods Inventory (146)
. Merchandise Inventory (147)
. Accountable Forms Inventory (148)
. Office Supplies Inventory (149)
. Medical, Dental and Laboratory Supplies Inventory (150)
. Food/Non-Food/Supplies Inventory (151)
. Gasoline, Oil and Lubricants Inventory (152)
. Agricultural Supplies Inventory (153)
. Livestock and Crops Inventory (154)
. Spare Parts Inventory (155)
. Construction Materials Inventory (156)
. Other Agricultural Products Inventory (157)
. Confiscated Goods Inventory (158)
. Other Inventory Items (160)
. Prepaid Rent (161)
. Prepaid Insurance (162)
. Prepaid Interest (164)
. Other Prepaid Expenses (165)
. Guaranty Deposits (166)
. Deposits on Letters of Credit (167)
. Advances to Contractors (168)
. Other Current Assets (170)
. Loans Receivable – Long-Term, LGUs (171)
. Loans Receivable – Long-Term, Others (173)
. Investment in Stocks (174)
. Investment in Bonds (175)
. Investment in GOCCs (176)
. Sinking Fund – Cash (177)
. Sinking Fund – Securities (178)
. Other Long-Term Investments (179)
. Land (201)
. Land Improvements (202)
. Accumulated Depreciation – Land Improvements (302)
. Leasehold Improvements (203)
. Accumulated Depreciation – Leasehold Improvements (303)
. Buildings (204)
. Accumulated Depreciation – Buildings (304)
. School Buildings (204)
. Accumulated Depreciation – School Buildings (305)
. Markets and Slaughterhouses (206)
. Accumulated Depreciation – Markets and Slaughterhouses (306)
. Hospitals and Health Centers (207)
. Accumulated Depreciation – Hospitals and Health Centers (307)
. Other Structures (208)
. Accumulated Depreciation – Other Structures (308)
. Industrial Machineries (209)
. Accumulated Depreciation – Industrial Machineries (309)
. Other Machineries (210)
. Accumulated Depreciation – Other Machineries (310)
. Firefighting Equipment and Accessories (211)
. Accumulated Depreciation – Firefighting Equipment and Accessories (311)
. Construction and Heavy Equipment (212)
. Accumulated Depreciation – Construction and Heavy Equipment (312)
. Technical and Scientific Equipment (214)
. Accumulated Depreciation – Technical and Scientific Equipment (314)
. IT Equipment and Software (215)
. Accumulated Depreciation – IT Equipment (315)
. Telegraph, Telephone, Cable, TV and Radio Equipment (216)
. Accumulated Depreciation – Telegraph, Telephone, Cable, TV and Radio Equipment (316)
. Artesian Wells, Reservoirs, Pumping Stations and Conduits (217)
. Accumulated Depreciation – Artesian Wells, Reservoirs, Pumping Stations and Conduits (317)
. Motor Vehicles (218)
. Accumulated Depreciation – Motor Vehicles (318)
. Watercrafts (219)
. Accumulated Depreciation – Watercrafts (319)
. Trains (220)
. Accumulated Depreciation – Trains (320)
. Aircrafts/Aircraft Ground Equipment (221)
. Accumulated Depreciation – Aircrafts/ Aircraft Ground Equipment (321)
. Office Equipment (222)
. Accumulated Depreciation – Office Equipment (322)
. Other Equipment (223)
. Accumulated Depreciation – Other Equipment (323)
. Furniture and Fixtures (224)
. Accumulated Depreciation – Furniture and Fixtures (324)
. Ordnance (225)
. Accumulated Depreciation – Ordnance (325)
. Books (226)
. Accumulated Depreciation – Books (326)
. Other Property, Plant and Equipment (227)
. Accumulated Depreciation – Other Property, Plant and Equipment (327)
. Work/Other Animals (228)
. Breeding Stocks (229)
. Construction in Progress – Agency Assets (230)
. Construction in Progress – Plaza, Parks and Monuments (231)
. Construction in Progress – Roads, Highways and Bridges (232)
. Construction in Progress – Ports, Lighthouses, Harbors, Seawalls, River Walls and Others (233)
. Construction in Progress – Airports and Runways (234)
. Construction in Progress – Railways (235)
. Construction in Progress – Waterways, Aqueducts, etc. (236)
. Construction in Progress – Irrigation, Canals and Laterals (237)
. Construction in Progress – Electrification, Power and Energy Structures (238)
. Construction in Progress – Other Public Infrastructures (241)
. Construction in Progress – Reforestation Projects (242)
. Public Infrastructures (243)
. Reforestation Projects (244)
. Arts, Archeological Specimen and Other Exhibits (245)
. Items in Transit (249)
. Other Assets (251)";
$liab=". Accounts Payable (401)
. Notes Payable (402)
. Loans Payable – Current, Domestic (403)
. Interests Payable (406)
. Guaranty Deposits Payable (408)
. Withholding Taxes Payable (410)
. GSIS Payable (411)
. PAG-IBIG Payable (412)
. PHILHEALTH Payable (413)
. Performance/Bidders/Bail Bonds Payable (414)
. Due to Officers and Employees (428)
. Due to Other Funds (429)
. Due to NGAs (430)
. Due to LGUs (431)
. Due to GOCCs (432)
. Retirement Gratuity Benefits Payable (439)
. Deferred Credits to Income (440)
. Other Deferred Credits (441)
. Deferred Real Property Tax Income (448)
. Deferred Special Education Tax (449)
. Other Payables (450)
. Loans Payable – Long-Term, Domestic (451)
. Mortgage Payable (453)
. Bonds Payable – Long-Term, Domestic (454)
. Other Long Term Liabilities (460)
. Other Liabilities (465)";

$equity=". Government Equity (501)
. Project Equity (502)
. Cost of Goods Sold (531)
. Income and Expense Summary (532)
. Prior Year's Adjustments (533)
. Retained Operating Surplus (534)
. Invested Equity (537)";

$income=". Subsidy from Other Local Government Units (604)
. Subsidy from Other Funds (605)
. Subsidy from Special Accounts (606)
. Sales Revenue (613)
. Dividend Income (623)
. Interest Income (624)
. Gain on Sale of Securities (625)
. Gain on Sale of Assets (626)
. Sale of Confiscated Goods and Properties (627)
. Foreign Exchange (FOREX) Gains (628)
. Miscellaneous Operating and Service Income (639)
. Fines and Penalties – Government Services and Business Operations (641)
. Income from Grants and Donations (651)
. Real Property Tax (711)
. Property Transfer Tax (712)
. Special Education Tax (713)
. Special Assessment Tax (714)
. Real Property Tax on Idle Lands (715)
. Business Taxes and Licenses (723)
. Franchise Tax (724)
. Professional Tax (725)
. Occupational Tax (726)
. Printing and Publication Tax (727)
. Miscellaneous Taxes on Good and Services (735)
. Community Tax (742)
. Weights and Measures (745)
. Share from Internal Revenue Collections (746)
. Share from Tobacco Excise Tax (747)
. Share from Economic Zones (748)
. Share from Expanded Value Added Tax (EVAT) (749)
. Share from National Wealth (750)
. Amusement Tax (751)
. Sand and Gravel Tax (752)
. Tax on Delivery Trucks and Vans (753)
. Miscellaneous Other Taxes (759)
. Fines and Penalties – Tax Revenue (760)
. Registration Fees (761)
. Tuition/Affiliation Fees (762)
. Hospital Fees (763)
. Medical, Dental and Laboratory Fees (764)
. Library Fees (765)
. Athletic and Cultural Fees (766)
. Comprehensive Examination Fees (767)
. Transcript of Records Fees (768)
. Diploma and Graduation Fees (769)
. Inspection Fees (770)
. Permit Fees (771)
. Garbage Fees (772)
. Clearance/Certification Fees (773)
. Fishery Rentals, Fees and Changes (775)
. Printing and Publication Income (776)
. Income from Canteen Operations (777)
. Income from Dormitory Operations (778)
. Receipt from Lease of Properties (779)
. Receipt from Communication Facilities (780)
. Receipt from Waterworks System (781)
. Receipt from Transportation System (782)
. Receipt from Markets (783)
. Receipt from Slaughterhouses (784)
. Receipt from Cemeteries (785)
. Income from Toll Fees (786)
. Income from Landing and Parking Fees (787)
. Other Income from School Services (788)
. Other Income from School Business Operations (789)
. Other Income from Hospital Services (790)
. Other Income from Hospital Business Operations (791)
. Other Specific Income of LGUs (792)
. Fines and Penalties – Other Specific Income (799)";

$exp=". Salaries and Wages – Regular Pay (801)
. Salaries and Wages – Part Time Pay (802)
. Salaries and Wages – Casual/Contractual (803)
. Personnel Economic Relief Allowance (PERA) (804)
. Additional Compensation (ADCOM) (805)
. Representation Allowance (RA) (806)
. Transportation Allowance (TA) (807)
. Clothing Allowance (808)
. Honoraria (809)
. Hazard Pay (810)
. Overtime and Night Pay (811)
. Holiday Pay (812)
. Christmas Bonus (813)
. Cash Gift (814)
. Productivity Incentive Benefits (815)
. Other Bonuses and Allowances (816)
. Life and Retirement Insurance Contributions (817)
. PAG-IBIG Contributions (818)
. PHILHEALTH Contributions (819)
. ECC Contributions (820)
. Pensions and Retirement Benefits (821)
. Terminal Leave Benefits (822)
. Health Workers' Benefits (823)
. Subsistence and Quarters' Allowances (824)
. Longevity Pay (825)
. Other Personnel Benefits (830)
. Traveling Expenses – Local (831)
. Traveling Expenses – Foreign (832)
. Training and Seminar Expenses (833)
. Water (834)
. Electricity (835)
. Cooking Gas (836)
. Telephone/Telegraph and Internet (837)
. Postage and Deliveries (838)
. Subscription Expenses (839)
. Advertising Expenses (840)
. Rent Expenses (841)
. Insurance Expenses (842)
. Fidelity Bond Premiums (843)
. Survey Expenses (844)
. Storage Expenses (845)
. Zoological/Animal Maintenance Expenses (846)
. Printing and Binding Expenses (847)
. Accountable Forms Expenses (848)
. Office Supplies Expenses (849)
. Medical, Dental and Laboratory Supplies Expenses (850)
. Food/Non-food Expenses (851)
. Gasoline, Oil and Lubricants Expenses (852)
. Agricultural Supplies Expenses (853)
. Legal Services (854)
. Auditing Services (855)
. Consultancy Services (856)
. General Services (857)
. Security/Janitorial Services (858)
. Taxes, Duties and Licenses (859)
. Tax Credit Subsidy (860)
. Public Infrastructure Repairs and Maintenance (862)
. Reforestation Project Maintenance (863)
. Buildings Maintenance (864)
. School Buildings Maintenance (863)
. Markets and Slaughterhouses Maintenance (866)
. Hospitals and Health Center Maintenance (867)
. Other Structures Maintenance (868)
. Industrial Machineries Maintenance (869)
. Other Machinery Maintenance (870)
. Firefighting Equipment and Accessories Maintenance (871)
. Construction and Heavy Equipment Maintenance (872)
. Technical and Scientific Equipment Maintenance (874)
. IT Equipment Maintenance (875)
. Telegraph, Telephone, Cable, TV and Radio Equipment Maintenance (876)
. Artesian Wells, Reservoirs, Pumping Stations and Conduits Maintenance (877)
. Motor Vehicles Maintenance (878)
. Watercrafts Maintenance (879)
. Trains Maintenance (880)
. Aircrafts/Aircraft Ground Equipment Maintenance (881)
. Office Equipment Maintenance (882)
. Other Equipment Maintenance (883)
. Furniture and Fixtures Maintenance (884)
. Ordnance Maintenance (885)
. Other Repairs and Maintenance (886)
. Awards and Indemnities (887)
. Rewards and Other Claims (888)
. Grants and Donations (889)
. Representation Expense (890)
. Extraordinary and Miscellaneous Expenses (891)
. Confidential and Intelligence Expenses (892)
. Anti-insurgency/Contingency Expenses (893)
. Subsidy to National Government Agencies (894)
. Subsidy to Local Government Units (895)
. Subsidy to Government Corporations (896)
. Subsidy to Other Funds (897)
. Subsidy to Special Accounts (898)
. Membership Dues to International Institutions (901)
. Depreciation – Land Improvements (902)
. Depreciation – Leasehold Improvements (903)
. Depreciation – Buildings (904)
. Depreciation – School Buildings (905)
. Depreciation – Markets and Slaughterhouses (906)
. Depreciation – Hospitals and Health Centers (907)
. Depreciation – Other Structures (908)
. Depreciation – Industrial Machineries (909)
. Depreciation – Other Machineries (910)
. Depreciation – Firefighting Equipment and Accessories (911)
. Depreciation – Construction and Heavy Equipment (912)
. Depreciation – Technical and Scientific Equipment (914)
. Depreciation – IT Equipment (915)
. Depreciation – Telegraph, Telephone, Cable, TV and Radio Equipment (916)
. Depreciation – Artesian Wells, Reservoirs, Pumping Stations and Conduits (917)
. Depreciation – Motor Vehicles (918)
. Depreciation – Watercrafts (919)
. Depreciation – Trains (920)
. Depreciation – Aircrafts/Aircraft Ground Equipment (921)
. Depreciation – Office Equipment (922)
. Depreciation – Other Equipment (923)
. Depreciation – Furniture and Fixtures (924)
. Depreciation – Ordnance (925)
. Depreciation – Books (926)
. Depreciation – Other Property, Plant and Equipment (927)
. Depreciation – Obsolescence – IT Software (928)
. Bad Debts Expense (929)
. Discount on Real Property Tax (937)
. Discount on Special Education Tax (938)
. Loss on Sale of Assets (947)
. Loss of Assets (948)
. Other Expenses (950)
. Bank Charges (951)
. Interest Expense (952)
. Documentary Stamps Expense (954)
. Other Financial Charges (955)
. Foreign Exchange (FOREX) Loss (956)";

$string=$asset;
$string=str_replace("","",$string);
$array=explode("\n",$string);
foreach($array as &$item)
{
  $name=substr($item,2,strlen($item)-8);
  $code=substr($item,-4,3);
  $at="at_asset";
  showaccount($name,$code,$at);
}

$string=$liab;
$string=str_replace("","",$string);
$array=explode("\n",$string);
foreach($array as &$item)
{
  $name=substr($item,2,strlen($item)-8);
  $code=substr($item,-4,3);
  $at="at_liability";
  showaccount($name,$code,$at);
}

$string=$equity;
$string=str_replace("","",$string);
$array=explode("\n",$string);
foreach($array as &$item)
{
  $name=substr($item,2,strlen($item)-8);
  $code=substr($item,-4,3);
  $at="at_equity";
  showaccount($name,$code,$at);
}

$string=$income;
$string=str_replace("","",$string);
$array=explode("\n",$string);
foreach($array as &$item)
{
  $name=substr($item,2,strlen($item)-8);
  $code=substr($item,-4,3);
  $at="at_income";
  showaccount($name,$code,$at);
}

$string=$exp;
$string=str_replace("","",$string);
$array=explode("\n",$string);
foreach($array as &$item)
{
  $name=substr($item,2,strlen($item)-8);
  $code=substr($item,-4,3);
  $at="at_expense";
  showaccount($name,$code,$at);
}


